﻿function chuanCan(phone,idCard,type,hraid){
    // 这个是页面顶部的nav
	$('.ul-nav li').each(function(x){
	    // 点击nav跳转到对应的部分
		$(this).click(function(){
			$(this).addClass('nav-active').siblings('li').removeClass('nav-active');
			var li0=$('section').eq(0).offset().top-50;
			var li1=$('section').eq(1).offset().top-50;
			var li2=$('section').eq(2).offset().top-50;
			var li3=$('section').eq(3).offset().top-50;
			if(x==0)
			{
				$('html,body').animate({scrollTop: li0}, 200)
			}
			if(x==1)
			{
				$('html,body').animate({scrollTop: li1}, 200)
			}
			if(x==2)
			{
				$('html,body').animate({scrollTop: li2}, 200)
			}
			if(x==3)
			{
				$('html,body').animate({scrollTop: li3}, 200)
			}
		});

        //滑动到对应的nav模块,对应的nav都是active状态;
        $(window).scroll(function(){
            var li0=$('section').eq(0).offset().top-80;
            var li1=$('section').eq(1).offset().top-80;
            var li2=$('section').eq(2).offset().top-80;
            var li3=$('section').eq(3).offset().top-80;
            var juanQi=$(window).scrollTop();
            if( juanQi >= 0 && juanQi<li1 )
            {
                $('.ul-nav li').eq(0).addClass('nav-active').siblings('li').removeClass('nav-active');
            }
            else if( juanQi >= li1 && juanQi<li2 )
            {
                $('.ul-nav li').eq(1).addClass('nav-active').siblings('li').removeClass('nav-active');
            }
            else if( juanQi >= li2 && juanQi<li3 )
            {
                $('.ul-nav li').eq(2).addClass('nav-active').siblings('li').removeClass('nav-active');
            }
            else if( juanQi >= li3)
            {
                $('.ul-nav li').eq(3).addClass('nav-active').siblings('li').removeClass('nav-active');
            }
        })

	});

    var arrKeyRisk=[];//获取每一个脏器的名称
    var zhong=[];//每一个脏器名称对应的level和value...后台返回的是json...
    var arrLevel=[];//获取每一个脏器对应的风险等级
    var numRisk=[];//获取每一个脏器对应的数值0~100之间
    var clr=[];//接收对应的颜色

    // 让表格隔行变色
    function color(x)
    {
        for(var i=0;i<x.length;i++)
        {
            if(i%2)
            {//为1时执行下面的程序
                x.eq(i).css('background','#F5F5F5');
            }
            else
            {//为0时执行下面的程序
                x.eq(i).css('background','');
            }
        }
    };
    var biao=$('table');
    for(var i=0;i<biao.length;i++)
    {
        color($('table tbody tr'));
    };
    // 判断表格当中数据的风险等级,返回颜色值
    function risklevel(value)
    {
        var val=Number(value);
        if(val>=0&&val<20)
        {
            return '#61B63B';
        }
        else if(val>=20&&val<40)
        {
            return '#2DA7E0';
        }
        else if(val>=40&&val<60)
        {
            return '#280cf2';
        }
        else if(val>=60&&val<80)
        {
            return '#f9f906';
        }
        else if(val>=80&&val<=100)
        {
            return '#E73215';
        }
    };
    // 调后台接口,让数据显示到页面当中+
    $.ajax({
        type:'post',
        async:false,
        url:'http://data.cqmjk.com/index/app/reportData',
        data:{'phone':phone,'idCard':idCard,'type':type,'hraid':hraid},
        success:successFn,
        error:function(){
            console.log('请求报表的接口出错了!');
        }
    });

    // 向后台发送ajax成功以后执行success的函数...
    function successFn(data)
    {
        var result=eval("("+data+")");
        var RiskImg=result.data[0].RiskImg;

        // 将后台返回的数据都展示在风险图当中...
        for(var key in RiskImg)
        {
            arrKeyRisk.push(key);
            zhong.push(RiskImg[key]);
        };
        for(var i=0;i<zhong.length;i++)
        {
            arrLevel.push(zhong[i]['Level']);//是风险等级
            // 将那些为null的数据都显示为5...表示健康...
            if( zhong[i]['value'] == 0 || zhong[i]['value']==null )
            {
                numRisk.push(5);//是一些数字和null
            }
            else
            {
                numRisk.push(zhong[i]['value']);//是一些数字
            }
        };
        for( var u =0;u< numRisk.length;u++)
        {
            if( numRisk[u]>0 && numRisk[u]<=20 ){//健康

                $('.risk_ul').append( '<li style="left: '+ (0.43*u+0.2) +'rem;"><div class="all_dom extra_health"><img src="images/0_health.svg" alt=""><span class="mark_point"></span></div></li>' );

                $('.risk_system').append('<li  style="left: '+ (0.43*u+0.2) +'rem;">'+ arrKeyRisk[u] +'</li>');

            }else if( numRisk[u]>=21 && numRisk[u]<30 ){//轻度一级

                $('.risk_ul').append( '<li style="left: '+ (0.43*u+0.2) +'rem;"><div class="all_dom"><img src="images/0_risk.svg" alt=""><span class="mark_point"></span></div></li>' );

                $('.risk_system').append('<li  style="left: '+ (0.43*u+0.2) +'rem;">'+ arrKeyRisk[u] +'</li>');

            }else if( numRisk[u]>=30 && numRisk[u]<40 ){//重度一级

                $('.risk_ul').append( '<li style="left: '+ (0.43*u+0.2) +'rem;"><div class="all_dom"><img src="images/1_risk.svg" alt=""><span class="mark_point"></span></div></li>' );

                $('.risk_system').append('<li  style="left: '+ (0.43*u+0.2) +'rem;">'+ arrKeyRisk[u] +'</li>');

            }else if( numRisk[u]>=40 && numRisk[u]<60 ){//二级风险

                $('.risk_ul').append( '<li style="left: '+ (0.43*u+0.2) +'rem;"><div class="all_dom"><img src="images/2_risk.svg" alt=""><span class="mark_point"></span></div></li>' );

                $('.risk_system').append('<li  style="left: '+ (0.43*u+0.2) +'rem;">'+ arrKeyRisk[u] +'</li>');

            }else if( numRisk[u]>=60 && numRisk[u]<80 ){//三级风险

                $('.risk_ul').append( '<li style="left: '+ (0.43*u+0.2) +'rem;"><div class="all_dom"><img src="images/3_risk.svg" alt=""><span class="mark_point"></span></div></li>' );

                $('.risk_system').append('<li  style="left: '+ (0.43*u+0.2) +'rem;">'+ arrKeyRisk[u] +'</li>');

            }else if( numRisk[u]>=80 && numRisk[u]<=100 ){//四级风险

                $('.risk_ul').append( '<li style="left: '+ (0.43*u+0.2) +'rem;"><div class="all_dom"><img src="images/4_risk.svg" alt=""><span class="mark_point"></span></div></li>' );

                $('.risk_system').append('<li  style="left: '+ (0.43*u+0.2) +'rem;">'+ arrKeyRisk[u] +'</li>');

            };

        };



        // 对应的颜色值
        for(var j=0;j<numRisk.length;j++)
        {
            clr.push( risklevel(numRisk[j]) );
        }
        var warning=result.data[0].RiskWarning;
        for(var x=0;x<13;x++)
        {
            $('.tips').eq(0).clone().appendTo($('section').eq(1));
        }
        // console.log(warning.length)
        system(warning.fengxian_huxixitong_zhuangtai,0,'呼吸系统的当前状态',warning.fengxian_huxixitong_zhuangtai_level,warning.fengxian_huxixitong_zhuangtai_shuoming,warning.pic_huxi);
        system(warning.fengxian_xiaohuaxitong_zhuangtai,1,'消化系统的当前状态',warning.fengxian_xiaohuaxitong_zhuangtai_level,warning.fengxian_xiaohuaxitong_zhuangtai_shuoming,warning.pic_xiaohua);
        system(warning.fengxian_mianyixitong_zhuangtai,2,'免疫系统的当前状态',warning.fengxian_mianyixitong_zhuangtai_level,warning.fengxian_mianyixitong_zhuangtai_shuoming,'');
        system(warning.fengxian_miniaoshengzhixitong_zhuangtai,3,'泌尿生殖系统和肾脏的当前状态',warning.fengxian_miniaoshengzhixitong_zhuangtai_level,warning.fengxian_miniaoshengzhixitong_shuoming,warning.pic_miniaoshengzhi);
        system(warning.fengxian_gugexitong_zhuangtai,4,'骨骼系统的当前状态',warning.fengxian_gugexitong_zhuangtai_level,warning.fengxian_gugexitong_shuoming,warning.pic_guge);
        system(warning.fengxian_xinxueguanxitong_zhuangtai,5,'心血管系统的当前状态',warning.fengxian_xinxueguanxitong_zhuangtai_level,warning.fengxian_xinxueguanxitong_shuoming,warning.pic_xinxueguan);
        system(warning.fengxian_neifenmixitong_zhuangtai,6,'内分泌系统的当前状态',warning.fengxian_neifenmixitong_zhuangtai_level,warning.fengxian_neifenmixitong_shuoming,'');
        system(warning.fengxian_shenjingxitong_zhuagntai,7,'神经系统的当前状态',warning.fengxian_shenjingxitong_zhuagntai_level,warning.fengxian_shenjingxitong_shuoming,'');
        system(warning.fengxian_ziyouji_zhuangtai,8,'自由基水平',warning.fengxian_ziyouji_zhuangtai_level,warning.fengxian_ziyouji_shuoming,'');
        system(warning.fengxian_guomin_zhuangtai,9,'过敏的当前状态',warning.fengxian_guomin_zhuangtai_level,warning.fengxian_guomin_shuoming,'');
        system(warning.fengxian_neihuanjing_zhuangtai,10,'内环境和基础代谢状况',warning.fengxian_neihuanjing_zhuangtai_level,warning.fengxian_neihuanjing_shuoming,'');
        system(warning.fengxian_erbihou_zhuangtai,11,'耳鼻喉的当前状态',warning.fengxian_erbihou_zhuangtai_level,warning.fengxian_erbihou_shuoming,warning.pic_erbihout);
        system(warning.fengxian_pifu_zhuangtai,12,'皮肤的当前状态',warning.fengxian_pifu_zhuangtai_level,warning.fengxian_pifu_shuoming,'');
        system(warning.fengxian_xipaobianxing_zhuangtai,13,'细胞变性的当前状态',warning.fengxian_xipaobianxing_zhuangtai_level,warning.fengxian_xipaobianxing_shuoming,'');
        system(warning.fengxian_ganran_zhuangtai,14,'感染的当前状态',warning.fengxian_ganran_zhuangtai_level,warning.fengxian_ganran_shuoming,'');
        // 各个系统的当前状态封装好的函数直接向里面传参数
        function system(a,b,c,d,e,f)
        {//a表示风险提示状态,b表示系数,c表示每一项的名称,d表示风险等级,e表示建议,f表示图片
            if( d!=null )
            {
                if( d == '' )
                {//判断是否存在风险等级
                    $('.tips').eq(b).children('h3').html(''+c+'<span class="level"></span>');
                }
                else
                {
                    $('.tips').eq(b).children('h3').html(''+c+'<span class="level">['+d+']</span>');
                };
                if( e == null )
                {//判断是否有建议
                    $('.tips').eq(b).children('dl').html('<dt>'+f+'</dt><dd>无</dd>');
                }
                else
                {
                    if( f=='' )
                    {//判断图片是否存在
                        $('.tips').eq(b).children('dl').html('<dt>'+f+'</dt><dd>'+e+'</dd>');
                    }
                    else
                    {
                        $('.tips').eq(b).children('dl').html('<dt><img src="http://data.cqmjk.com'+f+'" width="100%"></dt><dd>'+e+'</dd>');
                    };
                };
                if( d == '' && e == null )
                {//若建议和风险等级都不存在,就全部清空...不展示这条...
                    $('.tips').eq(b).children('h3').html('');
                    $('.tips').eq(b).children('h3').css({'height':'0','border':'none'});
                    $('.tips').eq(b).children('dl').html('');
                };
            }
            else
            {
                $('.tips').eq(b).children('h3').html('');
                $('.tips').eq(b).children('h3').css({'height':'0','border':'none'});
                $('.tips').eq(b).children('dl').html('');
            };
        };
        // 检测结果调接口  离子分析
        var lizi=result.data[0].ResultIon;
        function liZiFenXiFn(x,y)
        {
            if( ( (y>=(-5)) && (y<=5) ) || (y=='标准') )
            {
                $('table.lizifenxi_one tbody').children('tr').eq(x).children('td').eq(0).children('span.standard').html(y);
            }
            else
            {
                $('table.lizifenxi_one tbody').children('tr').eq(x).children('td').eq(0).children('span.standard').html(y);
                $('table.lizifenxi_one tbody').children('tr').eq(x).children('td').eq(0).children('span.standard').addClass('active');
                $('table.lizifenxi_one tbody').children('tr').eq(x).children('td').eq(0).children('span.ele').addClass('active');
            }
        }
        liZiFenXiFn(0,lizi.lizifenxi_na);
        liZiFenXiFn(1,lizi.lizifenxi_jia);
        liZiFenXiFn(2,lizi.lizifenxi_lv);
        liZiFenXiFn(3,lizi.lizifenxi_mei);
        liZiFenXiFn(4,lizi.lizifenxi_gai);
        liZiFenXiFn(5,lizi.lizifenxi_lin);
        liZiFenXiFn(6,lizi.lizifenxi_tie);
        //检查结果调接口   酸碱平衡
        var suanjian=result.data[0].AcidBase;
        function suanJianFn(x,y)
        {
            $('table.lizifenxi_two tbody').children('tr').eq(x).children('td').eq(0).children('span.zhi').html(y);
        }
                //判断PH
        if(suanjian.suanjianpingheng_ph>=7.29 && suanjian.suanjianpingheng_ph<=7.37)
        {
            suanJianFn(0,suanjian.suanjianpingheng_ph);
        }
        else
        {
            suanJianFn(0,suanjian.suanjianpingheng_ph);
            $('table.lizifenxi_two tbody').children('tr').eq(0).children('td').eq(0).children('span.zhi').addClass('active');
            $('table.lizifenxi_two tbody').children('tr').eq(0).children('td').eq(0).children('span.ele').addClass('active');
        }
            //判断HCO3
        if(suanjian.suanjianpingheng_hco3>=22 && suanjian.suanjianpingheng_hco3<=26)
        {
            suanJianFn(1,suanjian.suanjianpingheng_hco3);
        }
        else
        {
            suanJianFn(1,suanjian.suanjianpingheng_hco3);
            $('table.lizifenxi_two tbody').children('tr').eq(1).children('td').eq(0).children('span.zhi').addClass('active');
            $('table.lizifenxi_two tbody').children('tr').eq(1).children('td').eq(0).children('span.ele').addClass('active');
        }
            //判断PaCO2
        if(suanjian.suanjianpingheng_paco2>=41 && suanjian.suanjianpingheng_paco2<=51)
        {
            suanJianFn(2,suanjian.suanjianpingheng_paco2);
        }
        else
        {
            suanJianFn(2,suanjian.suanjianpingheng_paco2);
            $('table.lizifenxi_two tbody').children('tr').eq(2).children('td').eq(0).children('span.zhi').addClass('active');
            $('table.lizifenxi_two tbody').children('tr').eq(2).children('td').eq(0).children('span.ele').addClass('active');
        }
            //判断PaO2
        if(suanjian.suanjianpingheng__po2>=80.5 && suanjian.suanjianpingheng__po2<=88.5)
        {
            suanJianFn(3,suanjian.suanjianpingheng__po2);
        }
        else
        {
            suanJianFn(3,suanjian.suanjianpingheng__po2);
            $('table.lizifenxi_two tbody').children('tr').eq(3).children('td').eq(0).children('span.zhi').addClass('active');
            $('table.lizifenxi_two tbody').children('tr').eq(3).children('td').eq(0).children('span.ele').addClass('active');
        }
            //判断H+
        if(suanjian.suanjianpingheng_h>=42.6 && suanjian.suanjianpingheng_h<=51.3)
        {
            suanJianFn(4,suanjian.suanjianpingheng_h);
        }
        else
        {
            suanJianFn(4,suanjian.suanjianpingheng_h);
            $('table.lizifenxi_two tbody').children('tr').eq(4).children('td').eq(0).children('span.zhi').addClass('active');
            $('table.lizifenxi_two tbody').children('tr').eq(4).children('td').eq(0).children('span.ele').addClass('active');
        }
            //判断SBE
        if(suanjian.suanjianpingheng_sbe>(-2) && suanjian.suanjianpingheng_sbe<(+2))
        {
            suanJianFn(5,suanjian.suanjianpingheng_sbe);
        }
        else
        {
            suanJianFn(5,suanjian.suanjianpingheng_sbe);
            $('table.lizifenxi_two tbody').children('tr').eq(5).children('td').eq(0).children('span.zhi').addClass('active');
            $('table.lizifenxi_two tbody').children('tr').eq(5).children('td').eq(0).children('span.ele').addClass('active');
        }
            //判断ISO2
        if(suanjian.suanjianpingheng_iso2 == 98)
        {
            suanJianFn(6,suanjian.suanjianpingheng_iso2);
        }
        else
        {
            suanJianFn(6,suanjian.suanjianpingheng_iso2);
            $('table.lizifenxi_two tbody').children('tr').eq(6).children('td').eq(0).children('span.zhi').addClass('active');
            $('table.lizifenxi_two tbody').children('tr').eq(6).children('td').eq(0).children('span.ele').addClass('active');
        }
    //自由基水平
        var ziyouji=result.data[0].FreeLevel;
        function ziyoujiFn(x,y)
        {
            //判断水平
            if(y>=0 && y<=10)
            {
                $('table.lizifenxi_three tbody').children('tr').eq(x).children('td').eq(0).children('span.standard').html(y);
            }
            else
            {
                $('table.lizifenxi_three tbody').children('tr').eq(x).children('td').eq(0).children('span.standard').html(y);
                $('table.lizifenxi_three tbody').children('tr').eq(x).children('td').eq(0).children('span.ele').addClass('active');
                $('table.lizifenxi_three tbody').children('tr').eq(x).children('td').eq(0).children('span.standard').addClass('active');
            }
        }
        ziyoujiFn(0,ziyouji.ziyouji_guoyuangyaxiaosuan);
        ziyoujiFn(1,ziyouji.ziyouji_xiaofenzi);
        ziyoujiFn(2,ziyouji.ziyouji_guoyanghuaqing);
        ziyoujiFn(3,ziyouji.ziyouji_chaoyangyinlizi);
        ziyoujiFn(4,ziyouji.ziyouji_qiangziyouji);
    //神经递质
        var diZhi=result.data[0].Neurotransmitter;
        function diZhiFn(x,y)
        {
            if( ( y>=(-10) ) && (y<=10) )
            {
                $('table.lizifenxi_four tbody').children('tr').eq(x).children('td').eq(0).children('span.standard').html(y);
            }
            else
            {
                $('table.lizifenxi_four tbody').children('tr').eq(x).children('td').eq(0).children('span.standard').html(y);
                $('table.lizifenxi_four tbody').children('tr').eq(x).children('td').eq(0).children('span.ele').addClass('active');
                $('table.lizifenxi_four tbody').children('tr').eq(x).children('td').eq(0).children('span.standard').addClass('active');
            }
        }
        diZhiFn(0,diZhi.shenjingdizhi_wuqingsean);
        diZhiFn(1,diZhi.shenjingdizhi_duobaan);
        diZhiFn(2,diZhi.shenjingdizhi_erchafenan);
        diZhiFn(3,diZhi.shenjingdizhi_yixuandanjian);
    //生化相对指标
        var shengHua=result.data[0].Biochemical;
        function shengHuaFn(x,y)
        {
            if( ( y>=(-5) ) && (y<=5) )
            {
                $('table.lizifenxi_five tbody').children('tr').eq(x).children('td').eq(0).children('span.standard').html(y);
            }
            else
            {
                $('table.lizifenxi_five tbody').children('tr').eq(x).children('td').eq(0).children('span.standard').html(y);
                $('table.lizifenxi_five tbody').children('tr').eq(x).children('td').eq(0).children('span.ele').addClass('active');
                $('table.lizifenxi_five tbody').children('tr').eq(x).children('td').eq(0).children('span.standard').addClass('active');
            }
        }
        shengHuaFn(0,shengHua.shenghuazhibiao_ganyousanzhi);
        shengHuaFn(1,shengHua.shenghuazhibiao_gucaozhuananmei);
        shengHuaFn(2,shengHua.shenghuazhibiao_jianxinglinsuanmei);
        shengHuaFn(3,shengHua.shenghuazhibiao_xuetang);
        shengHuaFn(4,shengHua.shenghuazhibiao_LDLdimiduzhidanbai);
        //激素水平
        var jiSu=result.data[0].HormoneLevel;
        function jiSuFn(x,y)
        {
            if( ( y>=(-20) ) && (y<=20) )
            {
                $('table.lizifenxi_six tbody').children('tr').eq(x).children('td').eq(0).children('span.standard').html(y);
            }
            else
            {
                $('table.lizifenxi_six tbody').children('tr').eq(x).children('td').eq(0).children('span.standard').html(y);
                $('table.lizifenxi_six tbody').children('tr').eq(x).children('td').eq(0).children('span.ele').addClass('active');
                $('table.lizifenxi_six tbody').children('tr').eq(x).children('td').eq(0).children('span.standard').addClass('active');
            }
        }
        jiSuFn(0,jiSu.jisushuiping_cujiazhuangxian);
        jiSuFn(1,jiSu.jisushuiping_culuanpao);
        jiSuFn(2,jiSu.jisushuiping_tuoqingbiaoxiongtong);
        jiSuFn(3,jiSu.jisushuiping_pizhichun);
        jiSuFn(4,jiSu.jisushuiping_quangutong);
        jiSuFn(5,jiSu.jisushuiping_shenshangxian);
        //男人的是睾丸激素....女人的是雌激素....需要前端处理一下...默认显示雌激素
        if( jiSu.jisushuiping_cijisu == null )
        {
            $('table.lizifenxi_six tbody').children('tr').eq(6).children('td').eq(0).children('span.ele').html('间质的睾丸激素');
            jiSuFn(6,jiSu.jisushuiping__gaowanjisu);
        }
        else
        {
            jiSuFn(6,jiSu.jisushuiping_cijisu);
        }
        jiSuFn(7,jiSu.jisushuiping_yidaosu);
        jiSuFn(8,jiSu.jisushuiping_jiazhuangpangxian);
        jiSuFn(9,jiSu.jisushuiping_jiazhuangxian);
        jiSuFn(10,jiSu.jisushuiping__kangliniao);
        jiSuFn(11,jiSu.jisushuiping_cushenshangxianpizhi);
        //各脏器生物活性状态     呼吸系统
        var zangQi=result.data[0].VisceralAct;
        function zangQiFn(x,y,z)
        {
            if( ( y>=(-20) ) && (y<=20) )
            {
                $(z).children('tr').eq(x).children('td').eq(0).children('span.standard').html('['+y+']');
            }
            else if( ( y>=21 ) && (y<40) || (y>(-40)) && (y<=(-21)) )
            {
                $(z).children('tr').eq(x).children('td').eq(0).children('span.standard').html('['+y+']');
                // $(z).children('tr').eq(x).children('td').eq(0).children('span.ele').addClass('active');
                // $(z).children('tr').eq(x).children('td').eq(0).children('span.standard').addClass('active');
            }
            else if( (y>=40) && (y<60) || (y>(-60)) && (y<=(-40)))
            {
                if(y>0)
                {
                    $(z).children('tr').eq(x).children('td').eq(0).children('span.standard').html('span.standard').html('<span style="float: left;margin-right:0.05rem;">['+y+']</span>'+'<img src="images/up.svg" height="15" style="float: left;">'+'<img src="images/up.svg" height="15" style="float: left;">');
                    $(z).children('tr').eq(x).children('td').eq(0).children('span.ele').addClass('active');
                    $(z).children('tr').eq(x).children('td').eq(0).children('span.standard').addClass('active');
                }
                else
                {
                    $(z).children('tr').eq(x).children('td').eq(0).children('span.standard').html('<span style="float: left;margin-right:0.05rem;">['+y+']</span>'+'<img src="images/down.svg" height="15" style="float: left;">'+'<img src="images/down.svg" height="15" style="float: left;">');
                    $(z).children('tr').eq(x).children('td').eq(0).children('span.ele').addClass('active');
                    $(z).children('tr').eq(x).children('td').eq(0).children('span.standard').addClass('active');
                }
            }
            else if( (y>=60) && (y<80) || (y>(-80)) && (y<=(-60)))
            {
                if(y>0)
                {
                    $(z).children('tr').eq(x).children('td').eq(0).children('span.standard').html('<span style="float: left;margin-right:0.05rem;">['+y+']</span>'+'<img src="images/up.svg" height="15" style="float: left;">'+'<img src="images/up.svg" height="15" style="float: left;">'+'<img src="images/up.svg" height="15" style="float: left;">');
                    $(z).children('tr').eq(x).children('td').eq(0).children('span.ele').addClass('active');
                    $(z).children('tr').eq(x).children('td').eq(0).children('span.standard').addClass('active');
                }
                else
                {
                    $(z).children('tr').eq(x).children('td').eq(0).children('span.standard').html('<span style="float: left;margin-right:0.05rem;">['+y+']</span>'+'<img src="images/down.svg" height="15" style="float: left;">'+'<img src="images/down.svg" height="15" style="float: left;">'+'<img src="images/down.svg" height="15" style="float: left;">');
                    $(z).children('tr').eq(x).children('td').eq(0).children('span.ele').addClass('active');
                    $(z).children('tr').eq(x).children('td').eq(0).children('span.standard').addClass('active');
                }
            }
            else if( (y>=80) && (y<=100) || (y>=(-100)) && (y<=(-80)) )
            {
                if(y>0)
                {
                    $(z).children('tr').eq(x).children('td').eq(0).children('span.standard').html('<span style="float: left;margin-right:0.05rem;">['+y+']</span>'+'<img src="images/up.svg" height="15" style="float: left;">'+'<img src="images/up.svg" height="15" style="float: left;">'+'<img src="images/up.svg" height="15" style="float: left;">'+'<img src="images/up.svg" height="15" style="float: left;">');
                    $(z).children('tr').eq(x).children('td').eq(0).children('span.ele').addClass('active');
                    $(z).children('tr').eq(x).children('td').eq(0).children('span.standard').addClass('active');
                }
                else
                {
                    $(z).children('tr').eq(x).children('td').eq(0).children('span.standard').html('<span style="float: left;margin-right:0.05rem;">['+y+']</span>'+'<img src="images/down.svg" height="15" style="float: left;">'+'<img src="images/down.svg" height="15" style="float: left;">'+'<img src="images/down.svg" height="15" style="float: left;">'+'<img src="images/down.svg" height="15" style="float: left;">');
                    $(z).children('tr').eq(x).children('td').eq(0).children('span.ele').addClass('active');
                    $(z).children('tr').eq(x).children('td').eq(0).children('span.standard').addClass('active');
                }
            }
        };
        //各脏器生物活性状态     呼吸系统
        zangQiFn(0,zangQi.zangqihuoxing_qiguan,'table.zangQi_huxi tbody');
        zangQiFn(1,zangQi.zangqihuoxing_zhiqiguan,'table.zangQi_huxi tbody');
        zangQiFn(2,zangQi.zangqihuoxing_zuofeishangye,'table.zangQi_huxi tbody');
        zangQiFn(3,zangQi.zangqihuoxing_zuofeixiaye,'table.zangQi_huxi tbody');
        zangQiFn(4,zangQi.zangqihuoxing_youfeishangye,'table.zangQi_huxi tbody');
        zangQiFn(5,zangQi.zangqihuoxing_youfeizhongye,'table.zangQi_huxi tbody');
        zangQiFn(6,zangQi.zangqihuoxing_youfeixiaye,'table.zangQi_huxi tbody');
        zangQiFn(7,zangQi.zangqihuoxing_xiongbu_zuoce,'table.zangQi_huxi tbody');
        zangQiFn(8,zangQi.zangqihuoxing_xiongbu_youce,'table.zangQi_huxi tbody');
        //各脏器生物活性状态     耳鼻喉
        zangQiFn(0,zangQi.zangqihuoxing_zuoyanheleixian,'table.zangQi_erbihou tbody');
        zangQiFn(1,zangQi.zangqihuoxing_youyanheleixian,'table.zangQi_erbihou tbody');
        zangQiFn(2,zangQi.zangqihuoxing_zuoshanghedou,'table.zangQi_erbihou tbody');
        zangQiFn(3,zangQi.zangqihuoxing_youshanghedou,'table.zangQi_erbihou tbody');
        zangQiFn(4,zangQi.zangqihuoxing_zuocebiqianting,'table.zangQi_erbihou tbody');
        zangQiFn(5,zangQi.zangqihuoxing_youcebiqianting,'table.zangQi_erbihou tbody');
        zangQiFn(6,zangQi.zangqihuoxing_zuotuoyexian,'table.zangQi_erbihou tbody');
        zangQiFn(7,zangQi.zangqihuoxing_youtuoyexian,'table.zangQi_erbihou tbody');
        zangQiFn(8,zangQi.zangqihuoxing_zuoer,'table.zangQi_erbihou tbody');
        zangQiFn(9,zangQi.zangqihuoxing_youer,'table.zangQi_erbihou tbody');
        //各脏器生物活性状态     消化系统
        zangQiFn(0,zangQi.zangqihuoxing_shidao_shangduan,'table.zangQi_xihua tbody');
        zangQiFn(1,zangQi.zangqihuoxing_shidao_xiaduan,'table.zangQi_xihua tbody');
        zangQiFn(2,zangQi.zangqihuoxing_weiquyu,'table.zangQi_xihua tbody');
        zangQiFn(3,zangQi.zangqihuoxing_shierzhichang,'table.zangQi_xihua tbody');
        zangQiFn(4,zangQi.zangqihuoxing_xiaochang,'table.zangQi_xihua tbody');
        zangQiFn(5,zangQi.zangqihuoxing_mangchang_lanwei,'table.zangQi_xihua tbody');
        zangQiFn(6,zangQi.zangqihuoxing_shengjiechang,'table.zangQi_xihua tbody');
        zangQiFn(7,zangQi.zangqihuoxing_jiechang_ganqu,'table.zangQi_xihua tbody');
        zangQiFn(8,zangQi.zangqihuoxing_jiechang_pi,'table.zangQi_xihua tbody');
        zangQiFn(9,zangQi.zangqihuoxing_jiangjiechang,'table.zangQi_xihua tbody');
        zangQiFn(10,zangQi.zangqihuoxing_yizhuangjiechang,'table.zangQi_xihua tbody');
        zangQiFn(11,zangQi.zangqihuoxing_zhichang,'table.zangQi_xihua tbody');
        zangQiFn(12,zangQi.zangqihuoxing_ganzuoye_danguan,'table.zangQi_xihua tbody');
        zangQiFn(13,zangQi.zangqihuoxing_gan_youye,'table.zangQi_xihua tbody');
        zangQiFn(14,zangQi.zangqihuoxing_dannang,'table.zangQi_xihua tbody');
        zangQiFn(15,zangQi.zangqihuoxing_yixian,'table.zangQi_xihua tbody');
        //各脏器生物活性状态     神经系统
        zangQiFn(0,zangQi.zangqihuoxing_youceeyepicheng,'table.zangQi_shenjing tbody');
        zangQiFn(1,zangQi.zangqihuoxing_zuoceeyepiceng,'table.zangQi_shenjing tbody');
        zangQiFn(2,zangQi.zangqihuoxing_youce_nieye,'table.zangQi_shenjing tbody');
        zangQiFn(3,zangQi.zangqihuoxing_zuoce_nieye,'table.zangQi_shenjing tbody');
        zangQiFn(4,zangQi.zangqihuoxing_chuiti,'table.zangQi_shenjing tbody');
        zangQiFn(5,zangQi.zangqihuoxing_xiaqiunao,'table.zangQi_shenjing tbody');
        zangQiFn(6,zangQi.zangqihuoxing_qiunao,'table.zangQi_shenjing tbody');
        zangQiFn(7,zangQi.zangqihuoxing_zuo_xingrenti,'table.zangQi_shenjing tbody');
        zangQiFn(8,zangQi.zangqihuoxing_you_xingrenti,'table.zangQi_shenjing tbody');
        zangQiFn(9,zangQi.zangqihuoxing_zuoce_bianyuanxitong,'table.zangQi_shenjing tbody');
        zangQiFn(10,zangQi.zangqihuoxing_youce_bianyuanxitong,'table.zangQi_shenjing tbody');
        zangQiFn(11,zangQi.zangqihuoxing_zuoce_luneixueguan,'table.zangQi_shenjing tbody');
        zangQiFn(12,zangQi.zangqihuoxing_youce_luneixueguan,'table.zangQi_shenjing tbody');
        //各脏器生物活性状态     内分泌系统
        zangQiFn(0,zangQi.zangqihuoxing_zuoce_shenshangxiansuizhi,'table.zangQi_neifenmi tbody');
        zangQiFn(1,zangQi.zangqihuoxing_youce_shenshanxiansuizhi,'table.zangQi_neifenmi tbody');
        zangQiFn(2,zangQi.zangqihuoxing_jiazhuangxian,'table.zangQi_neifenmi tbody');
        zangQiFn(3,zangQi.zangqihuoxing_jiazhuangxian_zuoye,'table.zangQi_neifenmi tbody');
        zangQiFn(4,zangQi.zangqihuoxing_jiazhuangxian_youye,'table.zangQi_neifenmi tbody');
        zangQiFn(5,zangQi.zangqihuoxing_zuoce_jingbu,'table.zangQi_neifenmi tbody');
        zangQiFn(6,zangQi.zangqihuoxing_youce_jingbu,'table.zangQi_neifenmi tbody');
        //各脏器生物活性状态     免疫系统
        zangQiFn(0,zangQi.zangqihuoxing_xiongxian,'table.zangQi_mianyi tbody');
        zangQiFn(1,zangQi.zangqihuoxing_pizang,'table.zangQi_mianyi tbody');
        //各脏器生物活性状态     泌尿生殖系统  ?这个地方要判断他是男是女,根据情况而定;
        zangQiFn(0,zangQi.zangqihuoxing_zuoshen_shuniaoguan,'table.zangQi_miniao tbody');
        zangQiFn(1,zangQi.zangqihuoxing_youshen_shuniaoguan,'table.zangQi_miniao tbody');
        zangQiFn(2,zangQi.zangqihuoxing_pangguang,'table.zangQi_miniao tbody');
        // 判断是前列腺还是子宫
        if( (zangQi.zangqihuoxing_qianliexian != null) && (zangQi.zangqihuoxing_zuo_gaowan != null) )
        {//男性.前列腺.左睾丸
            zangQiFn(3,zangQi.zangqihuoxing_qianliexian,'table.zangQi_miniao tbody');
            zangQiFn(4,zangQi.zangqihuoxing_gaowan,'table.zangQi_miniao tbody');
        }
        else
        {//女性.子宫.卵巢
            zangQiFn(3,zangQi.zangqihuoxing_zigong,'table.zangQi_miniao tbody');
            zangQiFn(4,zangQi.zangqihuoxing_luancao,'table.zangQi_miniao tbody');
        }
        //各脏器生物活性状态     心血管系统
        zangQiFn(0,zangQi.zangqihuoxing_zuohenggemoshenjing,'table.zangQi_xinxuguan tbody');
        zangQiFn(1,zangQi.zangqihuoxing_youcegeshenjin,'table.zangQi_xinxuguan tbody');
        zangQiFn(2,zangQi.zangqihuoxing_zuoxi,'table.zangQi_xinxuguan tbody');
        zangQiFn(3,zangQi.zangqihuoxing_youxi,'table.zangQi_xinxuguan tbody');
        zangQiFn(4,zangQi.zangqihuoxing_zuodatui_shenjingxueguanshu,'table.zangQi_xinxuguan tbody');
        zangQiFn(5,zangQi.zangqihuoxing_youdatui_shenjingxueguanshu,'table.zangQi_xinxuguan tbody');
        zangQiFn(6,zangQi.zangqihuoxing_zuoxiaotui_shenjinxueguanshu,'table.zangQi_xinxuguan tbody');
        zangQiFn(7,zangQi.zangqihuoxing_youxiaotui_shenjingxueguanshu,'table.zangQi_xinxuguan tbody');
        zangQiFn(8,zangQi.zangqihuoxing_zuoshou_shenjingxueguanshu,'table.zangQi_xinxuguan tbody');
        zangQiFn(9,zangQi.zangqihuoxing_youshou_shenjingxueguanshu,'table.zangQi_xinxuguan tbody');
        zangQiFn(10,zangQi.zangqihuoxing_zuoshangbi_shenjingxueguanshu,'table.zangQi_xinxuguan tbody');
        zangQiFn(11,zangQi.zangqihuoxing_youshangbi_shenjingxueguanshu,'table.zangQi_xinxuguan tbody');
        zangQiFn(12,zangQi.zangqihuoxing_zuoqianbi_shenjingxueguanshu,'table.zangQi_xinxuguan tbody');
        zangQiFn(13,zangQi.zangqihuoxing_youqianbi_shenjingxueguanshu,'table.zangQi_xinxuguan tbody');
        zangQiFn(14,zangQi.zangqihuoxing_zuojiao_shenjingxueguanshu,'table.zangQi_xinxuguan tbody');
        zangQiFn(15,zangQi.zangqihuoxing_youjiao_shenjingxueguanshu,'table.zangQi_xinxuguan tbody');
        zangQiFn(16,zangQi.zangqihuoxing_xinzang,'table.zangQi_xinxuguan tbody');
        zangQiFn(17,zangQi.zangqihuoxing_zuo_jingdongmai,'table.zangQi_xinxuguan tbody');
        zangQiFn(18,zangQi.zangqihuoxing_you_jingdongmai,'table.zangQi_xinxuguan tbody');
        zangQiFn(19,zangQi.zangqihuoxing_shangqiangjingmai,'table.zangQi_xinxuguan tbody');
        zangQiFn(20,zangQi.zangqihuoxing_xiaqiangjingmai,'table.zangQi_xinxuguan tbody');
        zangQiFn(21,zangQi.zangqihuoxing_zuo_qiantingyaliganshouqi,'table.zangQi_xinxuguan tbody');
        zangQiFn(22,zangQi.zangqihuoxing_you_qiantingyaliganshouqi,'table.zangQi_xinxuguan tbody');
        zangQiFn(23,zangQi.zangqihuoxing_zhudongmai,'table.zangQi_xinxuguan tbody');
        zangQiFn(24,zangQi.zangqihuoxing_guanzhuangxueguan,'table.zangQi_xinxuguan tbody');
        zangQiFn(25,zangQi.zangqihuoxing_xinfeixunhuan,'table.zangQi_xinxuguan tbody');
        zangQiFn(26,zangQi.zangqihuoxing_menmaixunhuan,'table.zangQi_xinxuguan tbody');
        zangQiFn(27,zangQi.zangqihuoxing_xinji,'table.zangQi_xinxuguan tbody');
        zangQiFn(28,zangQi.zangqihuoxing_zuoxinshi,'table.zangQi_xinxuguan tbody');
        zangQiFn(29,zangQi.zangqihuoxing_youxinshi,'table.zangQi_xinxuguan tbody');
        //各脏器生物活性状态     骨骼系统    结构跟上面的不一样,需要自己封装函数
        function zangQiGuGeFn(x,y,z,m)
        {
            if( ( y>=(-20) ) && (y<=20) )
            {
                $(z).children('tr').eq(x).children('td').eq(m).children('span.standard').html('['+y+']');
            }
            else if( ( y>=21 ) && (y<40) || (y>(-40)) && (y<=(-21)) )
            {
                $(z).children('tr').eq(x).children('td').eq(m).children('span.standard').html('['+y+']');
                // $(z).children('tr').eq(x).children('td').eq(m).children('span.ele').addClass('active');
                // $(z).children('tr').eq(x).children('td').eq(m).children('span.standard').addClass('active');
            }
            else if( (y>=40) && (y<60) || (y>(-60)) && (y<=(-40)))
            {
                if(y>0)
                {
                    $(z).children('tr').eq(x).children('td').eq(m).children('span.standard').html('span.standard').html('<span style="float: left;margin-right:0.05rem;">['+y+']</span>'+'<img src="images/up.svg" height="15" style="float: left;">'+'<img src="images/up.svg" height="15" style="float: left;">');
                    $(z).children('tr').eq(x).children('td').eq(m).children('span.ele').addClass('active');
                    $(z).children('tr').eq(x).children('td').eq(m).children('span.standard').addClass('active');
                }
                else
                {
                    $(z).children('tr').eq(x).children('td').eq(m).children('span.standard').html('<span style="float: left;margin-right:0.05rem;">['+y+']</span>'+'<img src="images/down.svg" height="15" style="float: left;">'+'<img src="images/down.svg" height="15" style="float: left;">');
                    $(z).children('tr').eq(x).children('td').eq(m).children('span.ele').addClass('active');
                    $(z).children('tr').eq(x).children('td').eq(m).children('span.standard').addClass('active');
                }
            }
            else if( (y>=60) && (y<80) || (y>(-80)) && (y<=(-60)))
            {
                if(y>0)
                {
                    $(z).children('tr').eq(x).children('td').eq(m).children('span.standard').html('<span style="float: left;margin-right:0.05rem;">['+y+']</span>'+'<img src="images/up.svg" height="15" style="float: left;">'+'<img src="images/up.svg" height="15" style="float: left;">'+'<img src="images/up.svg" height="15" style="float: left;">');
                    $(z).children('tr').eq(x).children('td').eq(m).children('span.ele').addClass('active');
                    $(z).children('tr').eq(x).children('td').eq(m).children('span.standard').addClass('active');
                }
                else
                {
                    $(z).children('tr').eq(x).children('td').eq(m).children('span.standard').html('<span style="float: left;margin-right:0.05rem;">['+y+']</span>'+'<img src="images/down.svg" height="15" style="float: left;">'+'<img src="images/down.svg" height="15" style="float: left;">'+'<img src="images/down.svg" height="15" style="float: left;">');
                    $(z).children('tr').eq(x).children('td').eq(m).children('span.ele').addClass('active');
                    $(z).children('tr').eq(x).children('td').eq(m).children('span.standard').addClass('active');
                }
            }
            else if( (y>=80) && (y<=100) || (y>=(-100)) && (y<=(-80)) )
            {
                if(y>0)
                {
                    $(z).children('tr').eq(x).children('td').eq(m).children('span.standard').html('<span style="float: left;margin-right:0.05rem;">['+y+']</span>'+'<img src="images/up.svg" height="15" style="float: left;">'+'<img src="images/up.svg" height="15" style="float: left;">'+'<img src="images/up.svg" height="15" style="float: left;">'+'<img src="images/up.svg" height="15" style="float: left;">');
                    $(z).children('tr').eq(x).children('td').eq(0).children('span.standard').addClass('active');
                }
                else
                {
                    $(z).children('tr').eq(x).children('td').eq(m).children('span.standard').html('<span style="float: left;margin-right:0.05rem;">['+y+']</span>'+'<img src="images/down.svg" height="15" style="float: left;">'+'<img src="images/down.svg" height="15" style="float: left;">'+'<img src="images/down.svg" height="15" style="float: left;">'+'<img src="images/down.svg" height="15" style="float: left;">');
                    $(z).children('tr').eq(x).children('td').eq(m).children('span.ele').addClass('active');
                    $(z).children('tr').eq(x).children('td').eq(m).children('span.standard').addClass('active');
                }
            }
        };
        zangQiGuGeFn(0,zangQi.zangqihuoxing_c1,'table.zangQi_guge tbody',0);
        zangQiGuGeFn(1,zangQi.zangqihuoxing_c2,'table.zangQi_guge tbody',0);
        zangQiGuGeFn(2,zangQi.zangqihuoxing_c3,'table.zangQi_guge tbody',0);
        zangQiGuGeFn(3,zangQi.zangqihuoxing_c4,'table.zangQi_guge tbody',0);
        zangQiGuGeFn(4,zangQi.zangqihuoxing_c5,'table.zangQi_guge tbody',0);
        zangQiGuGeFn(5,zangQi.zangqihuoxing_c6,'table.zangQi_guge tbody',0);
        zangQiGuGeFn(6,zangQi.zangqihuoxing_c7,'table.zangQi_guge tbody',0);
        zangQiGuGeFn(7,zangQi.zangqihuoxing_c8,'table.zangQi_guge tbody',0);
        zangQiGuGeFn(8,zangQi.zangqihuoxing_th1,'table.zangQi_guge tbody',0);
        zangQiGuGeFn(9,zangQi.zangqihuoxing_th2,'table.zangQi_guge tbody',0);
        zangQiGuGeFn(10,zangQi.zangqihuoxing_th3,'table.zangQi_guge tbody',0);
        zangQiGuGeFn(11,zangQi.zangqihuoxing_th4,'table.zangQi_guge tbody',0);
        zangQiGuGeFn(12,zangQi.zangqihuoxing_th5,'table.zangQi_guge tbody',0);
        zangQiGuGeFn(13,zangQi.zangqihuoxing_th6,'table.zangQi_guge tbody',0);
        zangQiGuGeFn(14,zangQi.zangqihuoxing_th7,'table.zangQi_guge tbody',0);
        zangQiGuGeFn(15,zangQi.zangqihuoxing_th8,'table.zangQi_guge tbody',0);
        zangQiGuGeFn(0,zangQi.zangqihuoxing_th9,'table.zangQi_guge tbody',1);
        zangQiGuGeFn(1,zangQi.zangqihuoxing_th10,'table.zangQi_guge tbody',1);
        zangQiGuGeFn(2,zangQi.zangqihuoxing_th11,'table.zangQi_guge tbody',1);
        zangQiGuGeFn(3,zangQi.zangqihuoxing_th12,'table.zangQi_guge tbody',1);
        zangQiGuGeFn(4,zangQi.zangqihuoxing_l1,'table.zangQi_guge tbody',1);
        zangQiGuGeFn(5,zangQi.zangqihuoxing_l2,'table.zangQi_guge tbody',1);
        zangQiGuGeFn(6,zangQi.zangqihuoxing_l3,'table.zangQi_guge tbody',1);
        zangQiGuGeFn(7,zangQi.zangqihuoxing_l4,'table.zangQi_guge tbody',1);
        zangQiGuGeFn(8,zangQi.zangqihuoxing_l5,'table.zangQi_guge tbody',1);
        zangQiGuGeFn(9,zangQi.zangqihuoxing_s1,'table.zangQi_guge tbody',1);
        zangQiGuGeFn(10,zangQi.zangqihuoxing_s2,'table.zangQi_guge tbody',1);
        zangQiGuGeFn(11,zangQi.zangqihuoxing_s3,'table.zangQi_guge tbody',1);
        zangQiGuGeFn(12,zangQi.zangqihuoxing_s4,'table.zangQi_guge tbody',1);
        zangQiGuGeFn(13,zangQi.zangqihuoxing_s5,'table.zangQi_guge tbody',1);
    }



};
